package com.erb.service.zwj.impl;

import com.erb.entity.Pager;
import com.erb.entity.User;
import com.erb.mapper.AdminUserMapper;
import com.erb.service.zwj.IAdminUserService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Transactional
@Service("adminUserService")
public class AdminUserServiceImpl implements IAdminUserService {
	@Resource
	private AdminUserMapper adminUserMapper;

	@Override
	public List<User> findAll() {
		return adminUserMapper.selectAll();
	}

	@Override
	public List<User> findAllForSimpleList(Pager pager) {
		return adminUserMapper.selectAllForSimpleList(pager);
	}

	@Override
	public User findUser(Integer id) {
		if (id != null && id > 0) {
			return adminUserMapper.findUser(id);
		} else {
			return null;
		}
	}

	@Override
	public int findCount() {
		return adminUserMapper.selectCount();
	}

	@Override
	public boolean removeUser(Integer id) {
		return adminUserMapper.deleteUser(id) > 0;
	}
}
